import time

DEFAULT_FORMAT = "%Y-%m-%d %H:%M:%S"


def time_to_string(format_):
    """
    时间转字符
    Args:
        format_: 时间字符格式

    Returns: str

    """
    if format_ is None:
        format_ = DEFAULT_FORMAT
    str_time = time.strftime(format_, time.localtime())
    return str_time


if __name__ == '__main__':
    print(time_to_string(format_=None))
